﻿<script type="text/javascript">
    $(function () {
       //$("[name='khwldzKh']").qyjgzcombobox();
        //公司部门级联加载
        $("[name='khwldz_gs']").jgbmtree($("[name='khwldz_bm']"), '', '', '');
        $("#toolbar_khwldz_search [name='khwldz_lx']").val($("#khwldz_type").val());
        $("#khwldzKh").gsjgqczcombobox({
            onSuccess:function () {
                $("#khwldzKh").zcombobox("setMap", { id:$("#khwldzKh_id").val(), qc:$("#khwldzKh_qc").val()});
            }});
        //搜索按钮
        $("#toolbar_khwldz_search [name='btn_khwldz_search_init']").click(function () {
            $(grid).datagrid({
                queryParams:{
                    gsid:$("#toolbar_khwldz_search [name='khwldz_gs']").val(),
                    deptid:$("#toolbar_khwldz_search [name='khwldz_bm']").val(),
                    begindt:$("#toolbar_khwldz_search [name='khwldzStartDate']").val(),
                    enddt:$("#toolbar_khwldz_search [name='khwldzEndDate']").val(),
                    custname:$("#toolbar_khwldz_search [name='khwldzKh']").attr('_text'),
                    type:$("#toolbar_khwldz_search [name='khwldz_lx']").val()
                }});
        });

        var columns = [
            [
                {field:'dt', title:'日期', width:145, align:'center'},
                {field:'xsdh', title:'销售单号', width:250, align:'center'},
                {field:'bz', title:'品名/规格', width:145, align:'right'},
                {field:'cd', title:'产地', width:145, align:'right'},
                {field:'sl', title:'数量', width:145, formatter:function (v, r, i) {
                    return formatSl(v, ",", ".");
                }, align:'right'},
                {field:'dj', title:'单价', width:145, formatter:function (v, r, i) {
                    return formatSl(v, ",", ".");
                }, align:'right'},
                {field:'xsje', title:'销售金额', align:'right', formatter:function (v, r, i) {
                    return formatSl2(v, ",", ".");
                }, width:145},
                {field:'skje', title:'收款金额', width:145, formatter:function (v, r, i) {
                    return formatSl2(v, ",", ".");
                }, align:'right'},
                {field:'zhye', title:'账户余额', width:145, formatter:function (v, r, i) {
                    return formatSl2(v, ",", ".");
                }, align:'right'}
            ]
        ];

        var grid = $('#khwldz_into_grid').datagrid({
            url:$.webPath() + '/tjbb/khwl/khwldzlist',
            toolbar:"#toolbar_khwldz_search",
            pagination:true,
            rownumbers:true,
            singleSelect:true,
            collapsible:true,
            pageSize:100,
            fit:true,
            fitColumns:true,
            pageNumber:1,
            showFooter:true,
            queryParams:{
                gsid:$("#toolbar_khwldz_search [name='khwldz_gs']").val(),
                deptid:$("#toolbar_khwldz_search [name='khwldz_bm']").val(),
                begindt:$("#toolbar_khwldz_search [name='khwldzStartDate']").val(),
                enddt:$("#toolbar_khwldz_search [name='khwldzEndDate']").val(),
                custname:$("#toolbar_khwldz_search [name='khwldzKh']").attr('_text'),
                type:$("#toolbar_khwldz_search [name='khwldz_lx']").val()
            },
            columns:columns
        });

    })


</script>
<div class="easyui-layout" data-options="fit:true" style="width: 100%;height: 100%">
    <input id="khwldz_type" type="hidden" value="${(type)!}">
    <input type="hidden" id="khwldzKh_id" value="${(kh.id)!}"/>
    <input type="hidden" id="khwldzKh_qc" value="${(kh.qc)!}"/>
    <div data-options="region:'center'">
        <div id="toolbar_khwldz_search">
            <div class="textcon">
                <table class="tb" style="margin-left: 12px;">
                    <tr>
                        <th>类型：</th>
                        <td>
                            <select class="easyui-combobox searchinput-text" style="width:166px;" id="khwldz_lx"
                                    data-options="panelHeight:'150'" name="khwldz_lx">
                                <option value="2">财务</option>
                                <option value="1">业务</option>
                            </select>
                        </td>
                        <th>日期：</th>
                        <td><input name="khwldzStartDate" type="text" class="easyui-datebox" style="width:151px"
                                   value="${(begindt?date)!}"/></td>
                        <td align="center">至</td>
                        <td><input name="khwldzEndDate" type="text" class="easyui-datebox" style="width:151px"
                                   value="${(enddt?date)!}"/></td>
                    </tr>
                    <tr>
                        <th>客户：</th>
                        <td><input name="khwldzKh" id= "khwldzKh" type="text" class="input-text" value="${(kh.id)!}"/></td>
                        <th>公司：</th>
                        <td><input name="khwldz_gs" type="text" class="searchinput-text" value="${(gsid)!}"/>
                        </td>
                        <th>部门：</th>
                        <td><input name="khwldz_bm" type="text" class="easyui-combobox searchinput-text"
                                   data-options="valueField:'id',textField:'jc',panelWidth:'150'" value="${(deptid)!}"/>
                            <input name="btn_khwldz_search_init" type="button" value=""
                                   class="submit"/>
                    </tr>
                </table>
            </div>
        </div>
        <table id="khwldz_into_grid"></table>
    </div>
</div>